﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace QuanLyCayXanh.Models
{
    [Table("Tree")]
    public class Tree
    {
        public Tree()
        {
            this.Reports = new HashSet<Report>();
        }
    
        public int Id { get; set; }
        [Required(ErrorMessage = "{0} không được bỏ trống!")]
        [Display(Name="Tên Việt Nam")]
        public string NameVietNam { get; set; }
        [Display(Name="Tên khoa học")]
        public string ScientificName { get; set; }
        [Display(Name="Tọa độ X")]
        public double PointX { get; set; }
        [Display(Name="Tọa độ Y")]
        public double PointY { get; set; }
        [Display(Name="Dòng họ cây")]
        [ForeignKey("FamilyTree")]
        public Nullable<int> FamilyTree_Id { get; set; }
        
        [Display(Name="Nhóm cây")]
        [ForeignKey("GroupOfTree")]
        public Nullable<int> GroupOfTree_Id { get; set; }
        [Display(Name="Tuổi")]
        public Nullable<int> Age { get; set; }
        [Display(Name="Chiều cao")]
        public Nullable<double> Height { get; set; }
        [Display(Name="Đường kính cây")]
        public Nullable<double> Diameter { get; set; }
        [Display(Name="Ngày trồng")]
        public Nullable<System.DateTime> DateOfPlanting { get; set; }
        [Display(Name="Ngày chết")]
        public Nullable<System.DateTime> DateOfDeath { get; set; }
        [Display(Name="Lý do chết")]
        public string ReasonForDeath { get; set; }
        public Nullable<bool> Deleted { get; set; }
        public Nullable<System.DateTime> DateDeleted { get; set; }
        [ForeignKey("Street")]
        [Display(Name="Tên đường")]
        public Nullable<int> Street_Id { get; set; }
        [ForeignKey("Ward")]
        [Display(Name = "Tên Phường")]
        public Nullable<int> Ward_Id { get; set; }

        public virtual Street Street { get; set; }
        public virtual Ward Ward { get; set; }
        public virtual FamilyTree FamilyTree { get; set; }
        public virtual GroupOfTree GroupOfTree { get; set; }
        
        public virtual ICollection<Report> Reports { get; set; }
    }
}